package com.cskaoyan.controller.wxcontroller;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.wx.WxFootprintVO;
import com.cskaoyan.service.FootprintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author: hdf
 * @class: FootprintController
 */

@RestController
@RequestMapping("wx/footprint")
public class FootprintController {

    @Autowired
    FootprintService footprintService;

    /**
     * @author hdf
     * @description 获取足迹list
     * @param page
     * @param size
     * @return
     */
    @GetMapping("list")
    public BaseRespVo footprintList(Integer page,Integer size){
        WxFootprintVO wxFootprintVO = footprintService.footprintList(page, size);
        return BaseRespVo.ok(wxFootprintVO);
    }


    /**
     * @author hdf
     * @description 删除足迹，直接删除
     * @param map 封装{"id":1}
     * @return
     */
    @PostMapping("delete")
    public BaseRespVo footprintDelete(@RequestBody Map map){
        Integer id = (Integer) map.get("id");
        footprintService.footprintDelete(id);
        return BaseRespVo.ok();
    }
}
